package org.abc.fund.controller.funds;

import lombok.RequiredArgsConstructor;
import org.abc.fund.dto.tags.SimilarFundRecommendationDTO;
import org.abc.fund.dto.tags.TagClusterDTO;
import org.abc.fund.service.funds.TagClusterService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api")
@RequiredArgsConstructor
public class TagClusterController {

    private final TagClusterService tagClusterService;

    /**
     * 获取所有标签聚类
     */
    @GetMapping("/tags/clusters")
    public List<TagClusterDTO> getClusters() {
        return tagClusterService.getAllClusters();
    }

    /**
     * 获取某只基金的相似基金推荐
     */
    @GetMapping("/recommendations/similar")
    public SimilarFundRecommendationDTO getSimilarFunds(@RequestParam String fundCode) {
        return tagClusterService.getSimilarFunds(fundCode);
    }
}









